<?php

require_once('config.inc.php');

function get_db($database = "omegawiki") {
	$cfg = get_db_auth();
	$dbh = mysql_connect($cfg['host'], $cfg['username'], $cfg['password']) or die ("Error connecting to the server: " . mysql_error());
	mysql_select_db($database, $dbh) or die ("Error selecting database: " . mysql_error());
	mysql_query('SET NAMES utf8', $dbh);
	return $dbh;
}

function do_query($query, $dbh) {
	$result = mysql_query($query, $dbh) or die (mysql_error() . "<br />\nQuery: $query");
	return $result;
}

?>
